﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RPGGameServer.Biz
{
    public class BizManager
    {
        private readonly static Dictionary<Type, IBiz> dicBizs = new Dictionary<Type, IBiz>();

        static BizManager()
        {
            Add<AccountBiz>();
        }
        public static void Add<T>() where T: IBiz, new()
        {
            dicBizs.Add(typeof(T), new T());
        }

        public static T Get<T>() where T: class, IBiz
        {
            IBiz biz;
            if (dicBizs.TryGetValue(typeof(T), out biz))
            {
                return biz as T;
            }
            return null;
        }
    }
}
